Remove DerefMut impl for JS::MutableHandle#574
Merged
sagudev merged 2 commits intoservo:mainfrom Mar 26, 2025
Merged
Conversation
Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
3 tasks
sagudev
reviewed
Mar 26, 2025
Signed-off-by: Greg Morenz <greg-morenz@droid.cafe>
727956e to
1658f77
Compare
gmorenz
commented
Mar 26, 2025
| unsafe { *self.ptr = v } | ||
| } | ||
|
|
||
| /// The returned pointer is aliased by a pointer that the GC will read |
Contributor
Author
There was a problem hiding this comment.
I've added a task to the tracking issue to update this comment if we don't convert the GC to only write via interior mutability.
sagudev
approved these changes
Mar 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Like with #572 and #573 this impl allows for improper aliasing with the GC. With this type it also allows for outright use after frees, since
JS::MutableHandle, like a raw pointer, has no lifetime attached to it. Eventually that's a justification for removing theDerefimpl as well, but once thing at a time.There's only one use of this in servo, which is removed in the accompanying PR: servo/servo#36161
Like with #572 and #573 I added an unsafe
as_mutmethod, though it is unused locally this time as well as in servo. It feels like a reasonable escape hatch to share even if it isn't currently used.Part of #569, and can be merged entirely independently from #572 and #573.